package com.example.sdkintegration.controller;

import com.example.sdkintegration.entity.DemoEntity;
import com.isyscore.open.config.sdk.annotation.IscValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 配置中心测试Controller
 */
@RestController
@RequestMapping("/api/${api-module:}/config/test")
public class ConfigTestController {

    @IscValue("${config.test.value1}")
    private String value1;

    @IscValue("${config.test.entity}")
    public DemoEntity entity;

    @IscValue("${config.test.listEntity}")
    public List<DemoEntity> entityList;

    @IscValue("${config.test.map}")
    public Map<String, Object> map;


    @GetMapping("/value/get")
    private String getConfigValue(){
        return value1;
    }

    @GetMapping("/entity/get")
    private DemoEntity getConfigEntity(){
        return entity;
    }

    @GetMapping("/list/get")
    private List<DemoEntity> getConfigList(){
        return entityList;
    }

    @GetMapping("/map/get")
    private Map<String, Object> getConfigMap(){
        return map;
    }



}
